
package com.fis.mca.persistence;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import com.fis.mca.util.StringUtil;


/**
 * <p>Java class for mcaService complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="mcaService">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="autoRegister" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="code" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="mcaInteractions" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="mcaPackages" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="mcaSubPackages" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="mcaSubPromotions" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="promotionDetails" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="serviceId" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *         &lt;element name="status" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "mcaService", propOrder = {
    "autoRegister",
    "code",
    "description",
    "mcaInteractions",
    "mcaPackages",
    "mcaSubPackages",
    "mcaSubPromotions",
    "name",
    "promotionDetails",
    "serviceId",
    "status"
})
public class McaService implements Comparable<McaService>{

    protected String autoRegister;
    protected String code;
    protected String description;
    @XmlElement(nillable = true)
    protected List<Object> mcaInteractions;
    @XmlElement(nillable = true)
    protected List<Object> mcaPackages;
    @XmlElement(nillable = true)
    protected List<Object> mcaSubPackages;
    @XmlElement(nillable = true)
    protected List<Object> mcaSubPromotions;
    protected String name;
    @XmlElement(nillable = true)
    protected List<Object> promotionDetails;
    protected int serviceId;
    protected String status;

    /**
     * Gets the value of the autoRegister property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getAutoRegister() {
        return autoRegister;
    }

    /**
     * Sets the value of the autoRegister property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setAutoRegister(String value) 
    {
        if ("1".equals(value) || "true".equalsIgnoreCase(value))
        {
        	this.autoRegister = "1";
        }
        else
        {
        	this.autoRegister = "0";
        }
        	
    }

    /**
     * Gets the value of the code property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCode() {
        return code;
    }

    /**
     * Sets the value of the code property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCode(String value) {
        this.code = (value == null) ? value : value.toUpperCase().trim();
    }

    /**
     * Gets the value of the description property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the value of the description property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setDescription(String value) {
        this.description = (value == null) ? value : value.trim();
    }

    /**
     * Gets the value of the mcaInteractions property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the mcaInteractions property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getMcaInteractions().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     * 
     * 
     */
    public List<Object> getMcaInteractions() {
        if (mcaInteractions == null) {
            mcaInteractions = new ArrayList<Object>();
        }
        return this.mcaInteractions;
    }

    /**
     * Gets the value of the mcaPackages property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the mcaPackages property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getMcaPackages().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     * 
     * 
     */
    public List<Object> getMcaPackages() {
        if (mcaPackages == null) {
            mcaPackages = new ArrayList<Object>();
        }
        return this.mcaPackages;
    }

    /**
     * Gets the value of the mcaSubPackages property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the mcaSubPackages property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getMcaSubPackages().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     * 
     * 
     */
    public List<Object> getMcaSubPackages() {
        if (mcaSubPackages == null) {
            mcaSubPackages = new ArrayList<Object>();
        }
        return this.mcaSubPackages;
    }

    /**
     * Gets the value of the mcaSubPromotions property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the mcaSubPromotions property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getMcaSubPromotions().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     * 
     * 
     */
    public List<Object> getMcaSubPromotions() {
        if (mcaSubPromotions == null) {
            mcaSubPromotions = new ArrayList<Object>();
        }
        return this.mcaSubPromotions;
    }

    /**
     * Gets the value of the name property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setName(String value) {
        this.name = (value == null) ? value : value.trim();
    }

    /**
     * Gets the value of the promotionDetails property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the promotionDetails property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getPromotionDetails().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     * 
     * 
     */
    public List<Object> getPromotionDetails() {
        if (promotionDetails == null) {
            promotionDetails = new ArrayList<Object>();
        }
        return this.promotionDetails;
    }

    /**
     * Gets the value of the serviceId property.
     * 
     */
    public int getServiceId() {
        return serviceId;
    }

    /**
     * Sets the value of the serviceId property.
     * 
     */
    public void setServiceId(int value) {
        this.serviceId = value;
    }

    /**
     * Gets the value of the status property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getStatus() {
        return status;
    }

    /**
     * Sets the value of the status property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setStatus(String value) {
        this.status = (value == null) ? value : value.trim();
    }
    
    @Override
    public String toString()
    {
    	return this.name;
    }
    
	public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}
		if ((obj == null) || (obj.getClass() != this.getClass()))
		{
			return false;
		}
		// object must be Test at this point
		McaService service = (McaService) obj;
		return serviceId == service.getServiceId();
	}

	@Override
	public int compareTo(McaService service)
	{
		String o1 = this.getName();
		String o2 = service.getName();
		return StringUtil.compareVietnameseString(o1, o2);
	}
}
